package com.sly.demo.mapstruct.controller;

import com.sly.demo.mapstruct.model.converter.UserConverter;
import com.sly.demo.mapstruct.model.dto.UserDto;
import com.sly.demo.mapstruct.model.vo.UserVo;
import com.sly.demo.mapstruct.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Demo Controller
 *
 * @author SLY
 * @date 2022/8/7
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private DemoService demoService;

    /**
     * 获取用户及订单信息
     *
     * @return {@link UserVo}
     * @author SLY
     * @date 2022/8/7
     */
    @RequestMapping("/findUserOrderInfo")
    public UserVo findUserOrderInfo() {
        UserDto userDto = demoService.findUserOrderInfo();
        return UserConverter.INSTANCE.userDtoToUserVo(userDto);
    }
}
